Repository navigation
Write a class holding a property as one class - #151
Merged
Merged
Conversation
Under the default reading a character class holding a property, and a
property on its own, were written out as a group: \p{L}* became
(?:\p{L})*. A repeated group keeps a frame for each repetition, so
^\p{L}*$ refused a string of 100,000 letters ("the memory a check may
hold"), where 1.0.2 and pattern_dialect: :pcre serve it.
Such a class is now one class of the library's, with \p{...} inside it,
negated where the class is: [\x{30}-\x{39}\p{L}], [^\p{N}]. It matches
the same code points, and repeated it holds no frame per repetition.
The differential against node, the property comparison and the
uncharged canary give the same answers as before on OTP 28 and 29.
Signed-off-by: Ayla Croft <ayla@scriptkittyos.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Under the default (ECMA-262) reading, the translator wrote a character class holding a property, and a property on its own, as a group:
^\p{L}*$became^(?:\p{L})*$, and^[\p{L}\d]*$became^(?:[\x{30}-\x{39}]|\p{L})*$. A repeated group keeps a frame for each repetition, so these patterns refused a long string ("could not be matched against the required pattern in the memory a check may hold")::pcre^\p{L}*$^[\p{L}\d]*$^[a-z0-9]*$1.0.2 serves all of them at any length the body allows, and the docs say a class repeated is served at any length.
Such a class is now written as one class of the library's, with
\p{...}inside it, negated where the class is:^[\p{L}]*$,^[\x{30}-\x{39}\p{L}]*$,^[^\p{N}]*$. In UTF mode the subject holds no surrogate, so a negated class is ECMA-262's complement.Proof
Checks
tools/gate.shpasses on this tree. The suite passes on Elixir 1.20 with OTP 29.